﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenServe.Net.Client;
using System.Threading;
using OpenServe.Net.Messaging.Client;
using OpenServe.Net.Messaging;

namespace Sample_Client {
    class Program {
        static void Main(string[] args) {
            var c = new Client();
            c.Secure = true;
            c.Connect("localhost", 5000);
            var ret = c.DefaultHandler.ServerVersion();
            Console.WriteLine(ret);
            c.Send(new Message {
                Header = new Header { MessageType = "OpenChat" },
                Body = "help"
            });
            while (true) {
                var input = Console.ReadLine();
                if (input.StartsWith("/")) {
                    c.Send(new Message { 
                        Header = new Header { MessageType = "OpenChat" },
                        Body = input.TrimStart('/'),
                    });
                }
            }
            Console.ReadKey(true);
        }
    }
}
